﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication3
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        //登录界面
        protected void lg_Authenticate(object sender, AuthenticateEventArgs e)
        {
            var username = lg.UserName.Trim();
            var password = lg.Password.Trim();
            var sql = string.Format("select * from users where username='{0}'and password='{1}' ", username, password);
            var dt = DbHelper.GetData(sql);
            if (dt.Rows.Count == 1)
            {
                //登录成功，跳转页面
                Response.Redirect("Default.aspx");
            }
            else
            {
                //账号或密码错误
                lblcommant.Text = "用户名或密码不正确";
            }
        }
    }
}